package com.xxxx.server.controller;


import com.xxxx.server.pojo.Position;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.service.IPositionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 */
@RestController
@RequestMapping("/system/basic/pos")
public class PositionController {
    @Resource
    private IPositionService positionService;


    @ApiOperation(value = "查询职位")
    @GetMapping("/")
    public List<Position> selectPositionAll(){
        return positionService.selectPositionAll();
    }

    @ApiOperation(value = "批量删除职位")
    @DeleteMapping("/")
    public RespBean deletePositionByIds(Integer[] ids){
        return positionService.deletePositionByIds(ids);
    }

    @ApiOperation(value = "删除指定职位")
    @DeleteMapping("/{id}")
    public RespBean deletePositionById(@PathVariable() Integer id){
        return positionService.deletePositionById(id);
    }
    @ApiOperation(value = "添加职位")
    @PostMapping("/")
    public RespBean insertPosition(@RequestBody Position position){

        return positionService.insertPosition(position);
    }

    @ApiOperation(value = "编辑职位")
    @PutMapping("/")
    public RespBean updatePosition(@RequestBody Position position){

        return positionService.updatePosition(position);
    }
}
